Home

Glossary

 Application Icon Designing a search query
 

Writing your query as simply and as precisely as possible is the key to good search results. Following are some tips on how to write a good query.

Designing a good query

Suppose you want to search for information about the mercury contamination of fish and to focus on information released by or referring to the United States Environmental Protection Agency.

One problem with trying a simple AND search for a group of words is that the Environmental Protection Agency is referred to in various ways: 'Environmental Protection Agency', 'EPA' and 'E.P.A.'"

If we tried the search string

Example: Environmental AND Protection AND Agency AND EPA AND E.P.A. AND fish AND mercury

we would probably get no results at all, as no single article would use all three terms for the environmental agency. And even if we were to get search results, we would get irrelevant results stemming from the terms environmental, protection and agency.

Here's a better way to design the query:

Example: ("Environmental Protection Agency" OR EPA OR "E.P.A.")

which will pick up the variants in naming the agency in articles. Note that the two strings enclosed in quotation marks will now be treated as phrases. This reduces ambiguity. Also note the use of parentheses and the OR operator. We now cover all three variants of common names used for the environmental agency. DEVONagent Express will look for pages containing any one of those names.

There's another potential ambiguity, because it's possible that a large reference source might contain the word 'fish' in one section dealing with fishery resources, and contain the word 'mercury' in another section dealing with the history of barometers. We're simply not interested in that item. But if we use the NEAR operator between 'fish' and 'mercury' it's likely that we will get useful results, as this will place the space between the two terms at ten words or less.

The refined query now becomes:

Example: ("Environmental Protection Agency" OR EPA OR "E.P.A.") AND (fish NEAR mercury)

Notice that a second set of parentheses was used, so that DEVONagent Express won't wrongly interpret the query as requiring that both the environmental agency name and 'fish' must be NEAR 'mercury'. Just that confusion would be created if we had written the query as:

Example: ("Environmental Protection Agency" OR EPA OR "E.P.A." AND fish) NEAR mercury

Indeed, the refined search returned highly relevant pages. Of course, this search focused on literature about mercury contamination of fish in the United States. One could replace the search strings in the first set of parentheses with, e.g., ("European Union" OR EU) to change the geographical focus.

Improving your query

Besides the typical Boolean operators AND, OR and NOT, DEVONagent Express provides you with the much more powerful NEAR, BEFORE and AFTER operators. Typically, only scientific high-end databases feature them, but DEVONagent Express makes them available for Web research, also.

Note: Because almost none of the Web search engines support these operators, DEVONagent Express sends the simpler AND query to them and applies the more sophisticated operators to the resulting pages.

All three operators connect two search terms closer together than AND, but not as tightly as the phrase operator (double quotes). With the additional distance parameter (e.g., NEAR/5) you can also fine-tune the search results until you get only exactly the results you are looking for.

Example: (steve NEAR/2 jobs) BEFORE (intel NEAR (imac OR macbook)) AND "San Francisco"

Connecting 'steve' and 'jobs' with NEAR/2 prevents getting result pages of some Steve looking for a job in his page footer. BEFORE makes sure it's a page that mentions Steve Jobs first and then the Intel Macs. Finally, the quotes around 'San Francisco' find only pages dealing with the city of San Francisco, not the city San José and some Brother Francisco mentioned somewhere else on the page.

Use the proprietary NEAR, BEFORE and AFTER operators when AND delivers too many results and quoting delivers too few. Another example:

Example: document AND management AND mac

This query run with the Web plugin deliveres good results. But, many are not what we are looking for. Among many good pages, it also finds the Wikipedia article about Mac OS X because it contains all three words. But, of course, this article is not at all about document management on the Mac. But, we can refine this query with the special DEVONagent Express operators:

Example: document NEAR/2 management NEAR mac

This time, DEVONagent Express returns fewer results, all of them dealing exactly with our search subject, document management for the Macintosh, because the three words have to be mentioned near to each other in the text. In most cases, NEAR delivers more accurate results than AND.

First principle of a successful query

Make the query precise and unambiguous. DEVONagent Express' tools for clarifying your query are really quite simple and can help you obtain a high percentage of useful results rather than a confusing mess of irrelevant results.